package com.baishancloud.log.murloc

import scala.beans.BeanProperty


case class ResultKey(domain: Int, time_at: String, country: Int, province: Int, provider: Int) extends Serializable

/**
 * 结果对象
 *
 * @param domain      域名id
 * @param time_at     时间，五分钟粒度
 * @param country     国家，IdMap中的id
 * @param province    省份，IdMap中的id
 * @param provider    运营商，IdMap中的id
 * @param slow_count  慢速ip数量
 * @param total_count 总ip数量
 */
case class Result(
                   @BeanProperty domain: Int,
                   @BeanProperty time_at: String,
                   @BeanProperty country: Int,
                   @BeanProperty province: Int,
                   @BeanProperty provider: Int,
                   @BeanProperty slow_count: Long,
                   @BeanProperty total_count: Long
                 ) extends Serializable {
  def getKey: ResultKey = {
    ResultKey(domain, time_at, country, province, provider)
  }
}

object Result extends Serializable {
  def apply(key: ResultKey, slow_count: Long, total_count: Long): Result = {
    Result(key.domain, key.time_at, key.country, key.province, key.provider, slow_count, total_count)
  }
}



